Pacemaker - Set Virtual IP Address
2011/07/15 |
Set Virtual IP Address.
This example shows to configure on the environment like follows.
(1) www01.srv.world ( eth0 [192.168.1.60], eth1 [10.0.0.60] ) (2) www02.srv.world ( eth0 [192.168.1.61], eth1 [10.0.0.61] )
This example uses eth0 for inter-connection and uses eth1 for service provider. And set [10.0.0.100] for Virtual IP Address as an example.
|
|
[1] | Configure Virtual IP Address on a Host. |
[root@www01 ~]# crm configure crm(live)configure# primitive vip ocf:heartbeat:IPaddr2 \ > params ip="10.0.0.100" \ # Virtual IP Address > nic="eth1" \ > cidr_netmask="24" \ > op start interval="0s" timeout="60s" \ > op monitor interval="5s" timeout="20s" \ > op stop interval="0s" timeout="60s" crm(live)configure# show # make sure node www01.srv.world node www02.srv.world primitive vip ocf:heartbeat:IPaddr2 \ params ip="10.0.0.100" nic="eth1" cidr_netmask="24" \ op start interval="0s" timeout="60s" \ op monitor interval="5s" timeout="20s" \ op stop interval="0s" timeout="60s" property $id="cib-bootstrap-options" \ dc-version="1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe" \ cluster-infrastructure="openais" \ expected-quorum-votes="2" \ no-quorum-policy="ignore" \ stonith-enabled="false" rsc_defaults $id="rsc-options" \ resource-stickiness="INFINITY" \ migration-threshold="1"crm(live)configure# commit # enable settings crm(live)configure# exit bye |
[3] | Execute crm_mon and make sure status. |
[root@www01 ~]# crm_mon ============ Last updated: Fri Jul 15 20:59:16 2011 Stack: openais Current DC: www01.srv.world - partition with quorum Version: 1.1.2-f059ec7ced7a86f18e5490b67ebf4a0b963bccfe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Online: [ www01.srv.world www02.srv.world ] vip (ocf::heartbeat:IPaddr2): Started www01.srv.world |
[4] | Make sure to ping to Virtual IP Address if it answers. |
[root@www01 ~]# ping 10.0.0.100 PING 10.0.0.100 (10.0.0.100) 56(84) bytes of data. 64 bytes from 10.0.0.100: icmp_seq=1 ttl=64 time=0.016 ms 64 bytes from 10.0.0.100: icmp_seq=2 ttl=64 time=0.008 ms 64 bytes from 10.0.0.100: icmp_seq=3 ttl=64 time=0.009 ms 64 bytes from 10.0.0.100: icmp_seq=4 ttl=64 time=0.025 ms 64 bytes from 10.0.0.100: icmp_seq=5 ttl=64 time=0.014 ms 64 bytes from 10.0.0.100: icmp_seq=6 ttl=64 time=0.008 ms --- 10.0.0.100 ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 5149ms rtt min/avg/max/mdev = 0.008/0.013/0.025/0.006 ms |